# 结束页面
import pygame, sys
from pygame.locals import *
from text import *

def endPage(screen, endscore) :
    Author = TEXT("author : blankspace", AuthorColor, AuthorSize)

    GameOver = TEXT("Game Over", endPageTextColor, endPageTitleSize)
    Score = TEXT("Score : " + str(endscore), endPageTextColor, endPageScoreSize)
    scorePageTip = TEXT("Press ENTER key to exit", scorePageTipColor, tipSize)

    def printText() :
        Author.printText(AuthorPosition, screen)
        GameOver.printText(endPageTitlePosition, screen)
        Score.printText(endPageScorePosition, screen)
        scorePageTip.printText(tipPosition, screen)
        pygame.display.update()
    
    screen.fill(backgroundColor)
    printText()
    
    while True :
        for event in pygame.event.get() :
            if event.type == KEYDOWN :
                if event.key == K_RETURN :
                    Channel4.play(KeyBGM)
                    return